-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(integ-tests): allow for user provided assertions stack #22404
feat(integ-tests): allow for user provided assertions stack #22404
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
Is that even possible in this case 😀? |
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dontirun thanks for picking this up!
super(scope, 'Default'); | ||
|
||
this.scope = new Stack(scope, 'DeployAssert'); | ||
this.scope = new Stack(scope, 'DeployAssert', { env: props?.env }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to actually allow the user to pass their own Stack
. I think that is
what I originally intended to do. That also opens up the posibility to put the assertions in the
same Stack as your test stack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that a lot more! Let me refactor this PR
I also think it's beneficial in the case the user wanting to keep the stacks separated. It allows for creating lambda functions for the Lambda assertions independent from what is being integration tested
Pull request has been modified.
Hmm, this needs some more changes... test('Circular structure error', () => {
//GIVEN
const app = new App();
const assertionsStack = new Stack(app, 'AssertionsStack');
//WHEN
const integ = new IntegTest(app, 'integ', {
testCases: [],
assertionsStack: assertionsStack,
});
// THEN
Template.fromStack(assertionsStack);
}); TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Stack'
| property 'node' -> object with constructor 'Node'
--- property 'host' closes the circle
at JSON.stringify (<anonymous>)
178 | withVersion = preprocess(withVersion);
179 | }
> 180 | fs.writeFileSync(filePath, JSON.stringify(withVersion, undefined, 2));
| ^
181 | }
182 |
183 | private static loadManifest(filePath: string, schema: jsonschema.Schema, preprocess?: (obj: any) => any, options?: LoadManifestOptions) {
at Function.saveManifest (../cloud-assembly-schema/lib/manifest.ts:180:37)
at Function.saveIntegManifest (../cloud-assembly-schema/lib/manifest.ts:102:14)
at Function.write (lib/manifest-writer.ts:9:14)
at IntegManifestSynthesizer.synthesize (lib/manifest-synthesizer.ts:24:25)
at Object.onSynthesize (lib/test-case.ts:183:25)
at cb (../core/lib/private/synthesis.ts:188:15)
at visit (../core/lib/private/synthesis.ts:230:5)
at visit (../core/lib/private/synthesis.ts:226:5)
at synthesizeTree (../core/lib/private/synthesis.ts:175:3) |
It was because of this line and generating the manifest. I got around this by just changing the property name from |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Closes #22332
All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license